<template>
	<view>

		<uni-search-bar @confirm="search" placeholder="库存编码" v-model="searchValue">
		</uni-search-bar>	
		<view class="">
			<uni-card v-for="(item, index) in dataList" :key="index" :title="item.product.product_name" :sub-title="(item.shop ? item.shop.shop_name : '') + ' 编码【'+ item.code+'】'" :extra="item.status_str">
				操作日志
				<view v-for="(item2, index2) in item.logs">
					<view class="">
						{{item2.user.name}} - {{item2.option_str}} - {{item2.shop.shop_name}} 
					</view>
				</view>
			</uni-card>
		
		</view>
		<uni-load-more iconType="auto" :status="status" />
	</view>
</template>



<script>

	import api from "@/utils/api.js";
	export default {
		data() {
			return {
				dataList: [],
				status: 'more',
			}
		},
		onShow() {
			this.fetchData();
		},
		methods: {
			addShop(option_type){
				uni.navigateTo({
					url: "/pages/kucun/product_stock/add?option_type=" + option_type
				})
			},
			async fetchData(){
				let { result } = await api.productStockList();
				console.log(result)
				this.dataList = result['data']['list']
				if(result['data']['list'].length == 0) {
					this.status = "noMore"
				}else{
					this.status = "more"
				}
			}
		}
	}
</script>

<style>

	.option-button{
		margin-right: 10rpx;
	}
</style>
